package com.easymin.weixin.controller.web;

import com.easymin.weixin.common.DataGrid;
import com.easymin.weixin.entity.ApiLogs;
import com.easymin.weixin.manager.ApiLogsManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@RequestMapping("apilogs")
@Controller
public class ApiLogsController {

  @Autowired
  private ApiLogsManager apiLogsManager;

  @RequestMapping(value = {"", "/"}, method = RequestMethod.GET)
  public String index() {

    return "apilogs/list";
  }

  @RequestMapping(value = {"datagrid"}, method = RequestMethod.GET)
  public @ResponseBody DataGrid<ApiLogs> list(
      @RequestParam("page") int page,
      @RequestParam("rows") int rows) {

    return apiLogsManager.findAll(page, rows);
  }
}
